import { contextBridge, ipcRenderer } from "electron";

//窗体操作api
contextBridge.exposeInMainWorld("windowApi", {
  //最小化
  minimize: () => {
    ipcRenderer.send("window-min");
  },
  //向下还原|最大化
  maximize: () => {
    ipcRenderer.send("window-max");
  },
  //关闭
  close: () => {
    ipcRenderer.send("window-close");
  },
  /**
   * 窗口重置大小
   * @param {重置大小后的回调函数} callback
   */
  resize: (callback) => {
    ipcRenderer.on("window-resize", callback);
  },
});
